package Q3;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        String str = scanner.next();

        char[] ch = str.toCharArray();

        int count = 0;
        for (int i = 1; i < n; i++) {
            if (ch[i] < ch[i - 1]) {
                ch[i] = ch[i - 1];
                count++;
            }
        }

        System.out.println(count);
    }
}
